import { defineStore } from 'pinia'
import { ref, watch } from 'vue'
interface RuleForm {
  title: string
  block: number | string
  pinzhong: string
  zhonglei: string
  pinzhongtexing: string
  dianshanggoumailianjie: string
  nongchangzhu: string
  nongchangdizhi: string
  nongchangmianji: number | string
  shuling: number | string
  muchanliang: number | string
  chengshu: boolean
  caishoushijian: string
  caishoufzr: string
  jianceshijian: string
  jianceren: string
  jiancejieguo: string
  yulengshijian: string
  yulengfzr: string
  huanjinganquanBGUrl: string
  huanjinganquanBGName: string
  caihoujianceshijian: string
  pinzhijianceUrl: string
  nongchanghuanjingUrl: string
  canhoupinzhijianceUrl: string
  yulengUrl: string
  count: number
  time: string
}
export const useSuYuanStore = defineStore(
  'suYuan',
  () => {
    const formDataList = ref<RuleForm[]>([])
    watch(
      () => formDataList.value,
      (value) => {
        formDataList.value = value
      },
    )
    return { formDataList }
  },
  {
    persist: {
      storage: sessionStorage,
      key: 'formDataList',
    },
  },
)
